package top.iflyoung.cim.biz.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import top.iflyoung.cim.biz.entity.P2PChatMessage;
import top.iflyoung.cim.biz.mapper.P2PChatMessageMapper;
import top.iflyoung.cim.biz.service.P2PChatMessageService;
import top.iflyoung.cim.common.util.VerifyUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * @author liguiyang
 * @description P2PChatMessageService的实现
 * @sine 1.8
 * @date 2021/9/222:42
 **/
@Service("p2PChatMessageService")
public class P2PChatMessageServiceImpl extends ServiceImpl<P2PChatMessageMapper, P2PChatMessage> implements P2PChatMessageService {
    @Override
    public List<P2PChatMessage> findP2PChatMessage(Long senderId, Long receiverId) {
        List<P2PChatMessage> messages = new ArrayList<>();
        if (!VerifyUtil.isEmpty(senderId) && !VerifyUtil.isEmpty(receiverId)) {
            messages.addAll(baseMapper.queryAllMessages(senderId, receiverId));
        }
        return messages;
    }
}
